home *** CD-ROM | disk | FTP | other *** search
/ Acorn User: China / Acorn User China CD-ROM (UK) (Disc A) / Acorn User China CD-ROM (UK) (Disc A).bin / DEMON / DEVELOPER / HYPERMAIL.ARC / !hypermail_h_hypermail < prev    next >
Encoding:
Text File  |  1996-01-24  |  3.3 KB  |  156 lines

  1.  /*
  2. ** Copyright (C) 1994, Enterprise Integration Technologies Corp.          
  3. ** All Rights Reserved.
  4. ** Kevin Hughes, kevinh@eit.com
  5. ** 7/31/94
  6. */
  7.  
  8. #include "config.h"
  9.  
  10. #define VERSION    "1.02"
  11. #define PROGNAME   "hypermail"
  12. #define HMURL      "http://www.eit.com/software/hypermail/hypermail.html"
  13.  
  14. #define DIRNAME    "archive"
  15.  
  16. #ifdef RISCOS
  17.   #define INDEXNAME  "index"
  18.   #define DATENAME   "date"
  19.   #define THRDNAME   "thread"
  20.   #define SUBJNAME   "subject"
  21.   #define AUTHNAME   "author"
  22. #else
  23.   #define INDEXNAME  "index.html"
  24.   #define DATENAME   "date.html"
  25.   #define THRDNAME   "thread.html"
  26.   #define SUBJNAME   "subject.html"
  27.   #define AUTHNAME   "author.html"
  28. #endif
  29.  
  30.  
  31. #define NONAME     "(no name)"
  32. #define NODATE     "(no date)"
  33. #define NOEMAIL    "(no email)"
  34. #define NOSUBJECT  "(no subject)"
  35. #define MAXLINE       1000
  36. #define MAXFILELEN 100
  37. #define NAMESTRLEN 80
  38. #define NUMSTRLEN  10
  39. #define MAILSTRLEN 80
  40. #define DATESTRLEN 80
  41. #define MSGDSTRLEN 80
  42. #define REPYSTRLEN 240
  43. #define SUBJSTRLEN 100
  44. #define URLSTRLEN  100
  45. #define HASHSIZE   101
  46.  
  47. #define SHORTDATELEN   9
  48. #define TIMEZONELEN    10
  49. #define YEARLEN        5
  50. #define CENTURY        1900
  51. #define BASEYEAR       1970
  52. #define DAYSPERYEAR    365
  53. #define SECSPERMIN     60
  54. #define SECSPERHOUR    3600
  55. #define SECSPERDAY     86400
  56. #define IS_LEAP(y) (y > 1752 && (y % 4 == 0 && (y % 100 != 0 || y % 400 == 0)))
  57.  
  58. #include <stdio.h>
  59.  
  60. #ifdef RISCOS
  61.  #include <stdlib.h>
  62. #else
  63.  #include <sys/types.h>
  64.  #include <sys/stat.h>
  65.  #include <pwd.h>
  66. #endif
  67.  
  68. #ifndef MAIN_FILE
  69. #define VAR extern
  70. #else
  71. #define VAR
  72. #endif
  73.  
  74. struct reply {
  75.     int msgnum;
  76.     int frommsgnum;
  77.     char *name;
  78.     char *subject;
  79.     int maybereply;
  80.     struct reply *next;
  81. };
  82.  
  83. struct body {
  84.     char *line;
  85.     struct body *next;
  86. };
  87.  
  88. struct printed {
  89.     int msgnum;
  90.     struct printed *next;
  91. };
  92.  
  93. struct email {
  94.     int msgnum;
  95.     char *name;
  96.     char *emailaddr;
  97.     char *fromdatestr;
  98.     char *datestr;
  99.     char *msgid;
  100.     char *subject;
  101.     char *inreplyto;
  102.     struct body *bodylist;
  103.     struct email *next;
  104. };
  105.  
  106. struct header {
  107.     int msgnum;
  108.     char *name;
  109.     char *subject;
  110.     char *datestr;
  111.     int datenum;
  112.     struct header *left;
  113.     struct header *right;
  114. };
  115.  
  116. VAR struct header *subjectlist;
  117. VAR struct header *authorlist;
  118. VAR struct header *datelist;
  119. VAR struct reply *replylist;
  120. VAR struct reply *threadlist;
  121. VAR struct printed *printedlist;
  122. VAR struct printed *printedthreadlist;
  123. VAR struct email *etable[HASHSIZE];
  124. VAR char timezonestr[TIMEZONELEN];
  125. VAR char thisyear[YEARLEN];
  126. VAR char datename[NAMESTRLEN];
  127. VAR char thrdname[NAMESTRLEN];
  128. VAR char subjname[NAMESTRLEN];
  129. VAR char authname[NAMESTRLEN];
  130. VAR char errmsg[MAXLINE];
  131. VAR int firstdatenum;
  132. VAR int lastdatenum;
  133. VAR int bignum;
  134. VAR int showprogress;
  135. VAR int reverse;
  136. VAR int showheaders;
  137. VAR int showhtml;
  138. VAR int thrdlevels;
  139. VAR int dirmode;
  140. VAR int filemode;
  141.  
  142. #ifdef MAIN_FILE
  143. char *urls[] = { "http://", "gopher://", "file://", "ftp://",
  144.     "wais://", "telnet://", "news:", "mailto:", NULL };
  145. char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul",
  146.         "Aug", "Sep", "Oct", "Nov", "Dec" };
  147. char *days[] = { "Sun ", "Mon ", "Tue ", "Wed ", "Thu ", "Fri ", "Sat ", NULL };
  148. char monthnums[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
  149.         '0', '1', '2' };
  150. int monthdays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 30, 30, 31 };
  151. #else
  152. extern char *urls[], *months[], *days[];
  153. extern char monthnums[];
  154. extern int monthdays[];
  155. #endif
  156.